package handler

import (
	"dashenwo.com/dashenwo/micro_srv/search_srv/genpb"
	"dashenwo.com/dashenwo/micro_srv/search_srv/internal/service"
	"dashenwo.com/dashenwo/micro_srv/search_srv/registry"
	"github.com/micro/go-micro/v2/server"
	"github.com/micro/go-micro/v2/util/log"
)

func Apply(server server.Server, ctn *registry.Container) {
	// 创建所有需要注册的方法
	handlers := NewSearchHandler(ctn.Resolve("search_service").(*service.SearchService));
	// 注册服务
	err := genpb.RegisterSearchHandler(server,handlers)

	if err!=nil {
		log.Error("服务器启动失败，原因",err)
		panic(err)
	}
}